Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Using external and internal procedures

A separate source procedure, such as h-CustSample.p, is known as an external procedure. This is to distinguish it from another kind of the procedure that you’ll write as the next step in your sample. you can define one or more named entry points within an external procedure file, and these are called internal procedures. You run internal procedures in almost exactly the same way that you run external procedures, except that there is no .p filename extension on the internal procedure.

For your sample, you will run a procedure called calcDays that calculates the number of days between the ShipDate for each Order and today’s date. In order for calcDays to do the calculation, you need to pass the ShipDate to the procedure, and get the count of days back out. Progress supports parameters for its procedures to let you do this. Follow these guidelines:

To run the calcDays procedure from your sample procedure:

  1. Add the following RUN statement to your h-CustSample.p procedure, inside the FOR EACH Order OF Customer block, just before the END statement. Pass in the ShipDate field from the current Order and get back the calculated number of days, which uses the iDays variable you defined earlier when you learned to use the intelligent editor’s aliases:
  2. RUN calcDays (INPUT ShipDate, OUTPUT iDays). 
    

  3. Following this, still inside the FOR EACH Order block, write another statement to display the value you got back along with the rest of the Order information:
  4. DISPLAY iDays LABEL "Days" FORMAT "ZZZ9". 
    


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095